<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="d" uri="http://dgg.net/jsp/jstl/core" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%--协助办理人员弹窗--%>
<div class="dialog-warp-ajax" id="helpManage">
    <table class="dggui-table-info">
        <tbody>
            <tr>
                <th>流程人员：</th>
                <td>${productOrder.flowUserName}(${productOrder.flowUserOrgName})</td>
            </tr>
            <tr>
                <th>协单人员：</th>
                <td>
                    <select name="assistId" class="dggui-select" id="assistId"></select>
                </td>
            </tr>
        </tbody>
    </table>
</div>


<script type="text/javascript">

    $(document).ready(function () {
        var ids = '${ids}';//获取现在的协办人名单
        console.log(ids)
        var idStr = ids.split(",");
        var currentId =  '${productOrder.flowUserId}';//主订单办理人
        // dggui.use(['select2'],function () {
            var select2 = dggui.select2;
            //初始化流程人员
            $.post(sysInfo.basePath + '/rzsc/common/find_user_choose.do', {roleCode: "RZSC_FLOW_USER",type:'department',locked:0}, function (result) {
                if (result.code == 0) {
                    $.each(result.data, function (i, item) {
                        if(currentId != item.id){//不显示主订单的办理人
                            if(idStr.indexOf(item.id) != -1){
                                $("#assistId").append("<option value='" + item.id + "' selected>" + item.realName + "" + item.loginName + "</option>");
                            }else{
                                $("#assistId").append("<option value='" + item.id + "' >" + item.realName + "" + item.loginName + "</option>");
                            }
                        }
                    });
                } else {
                    console.log("查询数据错误");
                }

            });

        select2.render({
            allowClear: false,//清空选中
            elem: $('#assistId'),
            width: "100%",
            multiple: true,// 单选false或不写该参数，多选true
        });


        // });
    });
</script>

